﻿namespace Molten.Graphics;

/// <summary>
/// Represents the type of shader system value (SV_) type. e.g. SV_VertexID or SV_InstanceID.
/// <para>Replicates the values of the DirectX type: D3D_NAME. See: https://learn.microsoft.com/en-us/windows/win32/api/d3dcommon/ne-d3dcommon-d3d_name</para>
/// <para>For a list that includes newer system values, see: https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics</para>
/// </summary>
public enum ShaderSVType
{
    /// <summary>
    /// The system value type was unsupported, invalid or not provided.
    /// </summary>
    Undefined = 0,

    /// <summary>
    /// When SV_Position is declared for input to a shader, it can have one of two interpolation modes specified: linearNoPerspective or linearNoPerspectiveCentroid, 
    /// where the latter causes centroid-snapped xyzw values to be provided when multisample antialiasing. 
    /// When used in a shader, SV_Position describes the pixel location. Available in all shaders to get the pixel center with a 0.5 offset.
    /// </summary>
    Position = 1,

    /// <summary>
    /// Clip distance data. SV_ClipDistance values are each assumed to be a float32 signed distance to a plane. 
    /// Primitive setup only invokes rasterization on pixels for which the interpolated plane distance(s) are >= 0. 
    /// Multiple clip planes can be implemented simultaneously, 
    /// by declaring multiple component(s) of one or more vertex elements as the SV_ClipDistance. 
    /// </summary>
    ClipDistance = 2,

    /// <summary>
    /// Cull distance data. When component(s) of vertex Element(s) are given this label, 
    /// these values are each assumed to be a float32 signed distance to a plane. 
    /// Primitives will be completely discarded if the plane distance(s) for all of the vertices in the primitive are < 0. 
    /// Multiple cull planes can be used simultaneously, by declaring multiple component(s) of one or more vertex elements as the SV_CullDistance. 
    /// </summary>
    CullDistance = 3,

    /// <summary>
    /// Render-target array index. Applied to geometry shader output, and indicates the render target array slice that the primitive will be 
    /// drawn to by the pixel shader. SV_RenderTargetArrayIndex is valid only if the render target is an array resource. 
    /// This semantic applies only to primitives; if a primitive has more than one vertex, then the value from the leading vertex is used. 
    /// This value also indicates which array slice of a depth/stencil view is used for read/write purposes.
    /// Can be written from the geometry shader, and read by the pixel shader.
    /// </summary>
    RenderTargetArrayIndex = 4,

    /// <summary>
    /// Viewport array index. Applied to geometry shader output, and indicates which viewport to use for the primitive currently being written out. 
    /// Can be read by the pixel shader. The primitive will be transformed and clipped against the viewport specified by the index before it is passed to the rasterizer. 
    /// This semantic applies only to primitives; if a primitive has more than one vertex, then the value from the leading vertex is used.
    /// </summary>
    ViewportArrayIndex = 5,

    /// <summary>
    /// Per-vertex identifier automatically generated by the runtime. Available as the input to the vertex shader only
    /// </summary>
    VertexID = 6,

    /// <summary>
    /// Per-primitive identifier automatically generated by the runtime. Can be written to by the geometry or pixel shaders, 
    /// and read by the geometry, pixel, hull or domain shaders.
    /// </summary>
    PrimitiveID = 7,

    /// <summary>
    /// Per-instance identifier automatically generated by the runtime. Available to all shaders.
    /// </summary>
    InstanceID = 8,

    /// <summary>
    /// Specifies whether a triangle is front facing. For lines and points, IsFrontFace has the value true. 
    /// The exception is lines drawn out of triangles (wireframe mode), which sets IsFrontFace the same way as rasterizing the triangle in solid mode. 
    /// Can be written to by the geometry shader, and read by the pixel shader.
    /// </summary>
    IsFrontFace = 9,

    /// <summary>
    /// Sample frequency index data. Available to be read or written to by the pixel shader only.
    /// </summary>
    SampleIndex = 10,

    FinalQuadEdgeTessfactor = 11,

    FinalQuadInsideTessfactor = 12,

    FinalTriEdgeTessfactor = 13,

    FinalTriInsideTessfactor = 14,

    FinalLineDetailTessfactor = 0xF,

    FinalLineDensityTessfactor = 0x10,

    Barycentrics = 23,

    /// <summary>
    /// Defines, through shading rate values, the number of pixels written by one pixel shader invocation for Variable Shading Rate Tier 2 or higher devices. 
    /// Can be read from the pixel shader. Can be written from a vertex or geometry shader.
    /// </summary>
    Shadingrate = 24,

    Cullprimitive = 25,

    /// <summary>
    /// The output value that will be stored in a render target. 
    /// The index indicates which of the 8 possibly bound render targets to write to. The value is available to all shaders.
    /// </summary>
    Target = 0x40,

    /// <summary>
    /// Depth buffer data. Can be written by pixel shader.
    /// </summary>
    Depth = 65,

    Coverage = 66,

    /// <summary>
    /// In a pixel shader, allows outputting depth, as long as it is greater than or equal to the value determined by the rasterizer. 
    /// Enables adjusting depth without disabling early Z.
    /// </summary>
    DepthGreaterEqual = 67,

    /// <summary>
    /// In a pixel shader, allows outputting depth, as long as it is less than or equal to the value determined by the rasterizer. 
    /// Enables adjusting depth without disabling early Z.
    /// </summary>
    DepthLessEqual = 68,

    /// <summary>
    /// Represents the current pixel shader stencil reference value. Can be written by the pixel shader only.
    /// </summary>
    StencilRef = 69,

    /// <summary>
    /// Represents underestimated conservative rasterization information (i.e. whether a pixel is guaranteed-to-be-fully covered). 
    /// Can be read or written by the pixel shader.
    /// </summary>
    InnerCoverage = 70,

    /// <summary>
    /// Defines the global thread offset within the Dispatch call, per dimension of the group. Available as input to compute shader. Read-only.
    /// </summary>
    DispatchThreadID = 256,

    /// <summary>
    /// Defines the location on the hull of the current domain point being evaluated. Available as input to the domain shader. Read-only.
    /// </summary>
    DomainLocation = 257,

    /// <summary>
    /// Defines the group offset within a Dispatch call, per dimension of the dispatch call. Available as input to the compute shader. Read-only.
    /// </summary>
    GroupID = 258,

    /// <summary>
    /// Provides a flattened index for a given thread within a given group. Available as input to the compute shader. Read-only.
    /// </summary>
    GroupIndex = 259,

    /// <summary>
    /// Defines the thread offset within the group, per dimension of the group. Available as input to the compute shader. Read-only.
    /// </summary>
    GroupThreadID = 260,

    /// <summary>
    /// Defines the instance of the geometry shader. Available as input to the geometry shader. 
    /// The instance is needed as a geometry shader can be invoked up to 32 times on the same geometry primitive.
    /// </summary>
    GSInstanceID = 261,

    /// <summary>
    /// Defines the index of the control point ID being operated on by an invocation of the main entry point of the hull shader. Can be read by the hull shader only.
    /// </summary>
    OutputControlPointID = 262,

    /// <summary>
    /// Defines the tessellation amount within a patch surface. Available in the hull shader for writing, and available in the domain shader for reading.
    /// </summary>
    InsideTessFactor = 263,

    /// <summary>
    /// Defines the tessellation amount on each edge of a patch. Available for writing in the hull shader and reading in the domain shader.
    /// </summary>
    TessFactor = 264,
}
